package com.example.demo.mapper;

import com.example.demo.pojo.Announcement;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AnnouncementMapper {
    @Insert("insert into announcement(announcementtitle,announcementcontent,announcementpublishtime,userid)"+
    "values (#{announcementtitle},#{announcementcontent},now(),#{userid})")
    void add(Announcement announcement);

    @Select("select * from announcement")
    List<Announcement> findAll();


    List<Announcement> list(int userid, Integer categoryId);
}
